<div id="comments">
<a name="comments"></a>
<% if !@comments %>
<% @comments = comments %>
<% end %>
<h3><%= @comments.length %> Comments</h3>

<% for comment in @comments %>
	<div id="comment_<%= comment.id %>" class="comment">
		<% if logged_in? %>
			<script>
					$('comment_<%= comment.id %>').setAttribute('onMouseOver',"Element.show('comment_panel_<%= comment.id %>');"); 
					$('comment_<%= comment.id %>').setAttribute('onMouseOut',"Element.hide('comment_panel_<%= comment.id %>');"); 
			</script>
			<div id="comment_panel_<%= comment.id %>" class="comment_control" style="display: none;">
				<%= link_to 'Edit', edit_comment_path(comment.entry, comment) %>
		    <%= link_to 'Destroy', comment_path(comment.entry, comment), :confirm => 'Are you sure?', :method => :delete %>
			</div>
		<% end %>
		<div class="comment_header">
			<span class="comment_author">
			<% if comment.name && comment.email %>
				<%= link_to(comment.name, comment.email) %>
			<% elsif comment.name %>
				<%=h comment.name %>
			<% elsif comment.email %>
				<%= link_to(comment.email, comment.email) %>
			<% end %>
			</span>
			<span class="comment_created_at"><%= nice_date comment.created_at %></span>
			<%= "<div class=\"comment_url\">#{link_to(comment.url, comment.url)}</div>" if comment.url %>
		</div>
    <p><%= textilize(comment.content) %></p>
	</div>
<% end %>

<br />
</div>